/*******************************************************************
 * 外语翻译平台(translate) 
 *
 * 成都一亿信息技术公司 版权所有
 * 
 * Copyright (C) 2010 Transer Information Technology Co., Ltd.
 *
 * @Version : 1.0  2011-1-9 上午12:50:49
 *
 * Project.java 
 *
 *******************************************************************/
package com.transer.persistance.bean;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Date;

import com.transer.constant.Constants;
import com.transer.utils.DateUtils;

/**
 * class defination are there
 * 
 * @author Mark
 * 
 * @version 1.0 ywengineer@gmail.com
 * 
 */
public class Project implements Serializable {
	private static final long serialVersionUID = 4374094414897065018L;
	/** 编号 */
	private int id;
	/** 用户 编号 */
	private int userID;
	/** 标题 */
	private String title;
	/** 开始语言 */
	private int langFrom;
	/** 翻译类型 */
	private String translateType;
	/** 目标语言 */
	private int langTo;
	/** 领域 */
	private int area;
	/** 预算 */
	private int money;
	/** 开始日期 */
	private Date start;
	/** 结束日期 */
	private Date end;
	/** 是否开发票 */
	private boolean invoice;
	/** 描述 */
	private String desc;
	/** 文档 */
	private String doc;
	/** 竞标成功长工作时长 */
	private int workDays;
	/** 状态 */
	private int status = Constants.PROJECT_STATUS_START;
	// 关键字
	private String keyWords;
	// 工作开始日期
	private Date workBeginDate;

	/**
	 * @return the workBeginDate
	 */
	public Date getWorkBeginDate() {
		return workBeginDate;
	}

	/**
	 * @param workBeginDate the workBeginDate to set
	 */
	public void setWorkBeginDate(Date workBeginDate) {
		this.workBeginDate = workBeginDate;
	}

	public long leftHours() {
		return DateUtils.dateDiff(new Date(), getEnd());
	}

	public long leftSeconds() {
		return (getEnd().getTime() - new Date().getTime()) / 1000;
	}

	/**
	 * @return the keyWords
	 */
	public String getKeyWords() {
		return keyWords;
	}

	/**
	 * @param keyWords
	 *            the keyWords to set
	 */
	public void setKeyWords(String keyWords) {
		this.keyWords = keyWords;
	}

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param title
	 *            the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return the langFrom
	 */
	public int getLangFrom() {
		return langFrom;
	}

	/**
	 * @param langFrom
	 *            the langFrom to set
	 */
	public void setLangFrom(int langFrom) {
		this.langFrom = langFrom;
	}

	/**
	 * @return the langTo
	 */
	public int getLangTo() {
		return langTo;
	}

	/**
	 * @param langTo
	 *            the langTo to set
	 */
	public void setLangTo(int langTo) {
		this.langTo = langTo;
	}

	/**
	 * @return the area
	 */
	public int getArea() {
		return area;
	}

	/**
	 * @param area
	 *            the area to set
	 */
	public void setArea(int area) {
		this.area = area;
	}

	/**
	 * @return the money
	 */
	public int getMoney() {
		return money;
	}

	/**
	 * @param money
	 *            the money to set
	 */
	public void setMoney(int money) {
		this.money = money;
	}

	/**
	 * @return the start
	 */
	public Date getStart() {
		return start;
	}

	/**
	 * @param start
	 *            the start to set
	 */
	public void setStart(Date start) {
		this.start = start;
	}

	/**
	 * @return the end
	 */
	public Date getEnd() {
		return end;
	}

	/**
	 * @param end
	 *            the end to set
	 */
	public void setEnd(Date end) {
		this.end = end;
	}

	/**
	 * @return the invoice
	 */
	public boolean isInvoice() {
		return invoice;
	}

	/**
	 * @param invoice
	 *            the invoice to set
	 */
	public void setInvoice(boolean invoice) {
		this.invoice = invoice;
	}

	/**
	 * @return the desc
	 */
	public String getDesc() {
		return desc;
	}

	/**
	 * @param desc
	 *            the desc to set
	 */
	public void setDesc(String desc) {
		this.desc = desc;
	}

	/**
	 * @return the doc
	 */
	public String getDoc() {
		return doc;
	}

	/**
	 * @param doc
	 *            the doc to set
	 */
	public void setDoc(String doc) {
		this.doc = doc;
	}

	/**
	 * @return the status
	 */
	public int getStatus() {
		return status;
	}

	/**
	 * @param status
	 *            the status to set
	 */
	public void setStatus(int status) {
		this.status = status;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		Field[] fields = this.getClass().getDeclaredFields();
		StringBuffer buffer = new StringBuffer();
		for (Field field : fields) {
			if (!field.isAccessible()) {
				field.setAccessible(true);
			}
			try {
				buffer.append(field.getName() + "=" + field.get(this));
			} catch (IllegalArgumentException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}
			buffer.append("@");
		}
		return buffer.toString();
	}

	/**
	 * @return the userID
	 */
	public int getUserID() {
		return userID;
	}

	/**
	 * @param userID
	 *            the userID to set
	 */
	public void setUserID(int userID) {
		this.userID = userID;
	}

	/**
	 * @return the workDays
	 */
	public int getWorkDays() {
		return workDays;
	}

	/**
	 * @param workDays
	 *            the workDays to set
	 */
	public void setWorkDays(int workDays) {
		this.workDays = workDays;
	}

	/**
	 * @return the translateType
	 */
	public String getTranslateType() {
		return translateType;
	}

	/**
	 * @param translateType
	 *            the translateType to set
	 */
	public void setTranslateType(String translateType) {
		this.translateType = translateType;
	}
}
